package com.lagou.rpc.consumer;

import com.lagou.rpc.consumer.config.Curator;
import com.lagou.rpc.consumer.config.Watcher;
import org.apache.curator.framework.CuratorFramework;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;

@SpringBootApplication
public class ClientBootStrapApplication implements CommandLineRunner {
    @Autowired
    private ApplicationContext appContext;
    @Autowired
    Curator curator;
    @Autowired
    Watcher watcher;

    public static void main(String[] args) {
        SpringApplication.run(ClientBootStrapApplication.class, args);
    }



    @Override
    public void run(String... args) throws Exception {
        CuratorFramework client = curator.getClient();
        watcher.watchZookeeperNode(client,"/base");
    }
}
